/*******************************************************************************
 * Copyright 2011 Alexandre Zglav and Morphiastic
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package com.morphiastic.analysis;

import java.io.IOException;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
public interface AnalysisComponentDefinition {
	
	
	
	public AnalysisComponentType getComponentType();
	
	
	public String getDefinitionName();
	
	
	
	/**
	 * returns true if the analyzer definition has custom parameters
	 * @return
	 */
	public boolean hasCustomParams();


	/**
	 * adds the tokenizer/analyzer/filter definition to the settings builder
	 * @param mappingBuilder
	 * @return
	 * @throws IOException
	 */
	public XContentBuilder addToBuilder(XContentBuilder settingsBuilder) throws IOException;
	
	
	/**
	 * sets the tokenizer custom parameters from a 
	 * Settings object that contains this tokenizer specific settings
	 * @param analyzerSettings
	 */
	public void setParamsFromSettings(Settings settings);
	
	
	public boolean areEquivalentDefinitions(AnalysisComponentDefinition other);
	
	/**
	 * returns the subtype of the component as it is known in ElasticSearch
	 * ex : nGram for NGram tokenizer
	 * @return
	 */
	public String getComponentSubTypeName();
	
	
	
	
	
	
	
}
